package com.buercorp.wangyu.core1.ch12.threads;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 创建线程方式二 Runnable 接口
 * @author 忆白
 */
public class ThreadText3 implements Runnable{
//    private static final Logger log = LoggerFactory.getLogger(ThreadText3.class);

    @Override
    public void run() {
//        System.out.println("runnable接口");
        System.out.println("子线程里面");
    }

    public static void main(String[] args) {
        ThreadText3 threadText3 = new ThreadText3();
        new Thread(threadText3).start();

        Thread thread = new Thread(() ->{
            System.out.println("2.线程Runnable");
        });
//        ThreadText3 threadText3 = new ThreadText3();
//        Thread thread1 = new Thread(threadText3);
//        thread.start();
        thread.start(); // 异步
//        thread.run();  // 同步
        System.out.println(("1.开始创建"));
        System.out.println("3.主线程");

    }
}
